package com.bangbang.controller;



import com.bangbang.service.nearService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.geo.Point;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class nearController {
    @Autowired
    private nearService nearService;

    @RequestMapping("/geo/save")
    public void save(String userId,String longitude,String latitude){
        Point point = new Point(Double.valueOf(longitude),Double.valueOf(latitude));
        nearService.save(point,userId);
    }

    @RequestMapping("/geo/near")
    public Object near(String longitude,String latitude){
        Point point = new Point(Double.valueOf(longitude),Double.valueOf(latitude));
        return nearService.near(point);
    }
}
